package com.xbongbong.paas.model.impl;

import com.xbongbong.paas.model.ContractEditFileModel;
import com.xbongbong.paas.toolbox.util.DateTimeUtil;
import com.xbongbong.saas.domain.dao.ContractEditFileDao;
import com.xbongbong.saas.domain.entity.ContractCompareEntity;
import com.xbongbong.saas.domain.entity.ContractEditFileEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author: yingjf
 * @date: 2023/3/7 18:50
 * @description:
 */
@Service("contractEditFileModel")
public class ContractEditFileModelImpl implements ContractEditFileModel {
    @Resource
    private ContractEditFileDao contractEditFileDao;

    @Override
    public Long insert(ContractEditFileEntity entity) {
        long now = DateTimeUtil.getInt();
        entity.setAddTime(now);
        entity.setUpdateTime(now);
        return contractEditFileDao.insert(entity);
    }

    @Override
    public void insertBatch(List<ContractEditFileEntity> list) {
        contractEditFileDao.insertBatch(list);
    }

    @Override
    public List<ContractEditFileEntity> findEntities(Map<String, Object> param) {
        return contractEditFileDao.findEntities(param);
    }

    @Override
    public Integer getEntityCount(Map<String, Object> param) {
        return contractEditFileDao.getEntitiesCount(param);
    }

    @Override
    public void update(ContractEditFileEntity entity) {
        contractEditFileDao.update(entity);
    }

    @Override
    public ContractEditFileEntity getByKey(Long key, String corpid) {
        return contractEditFileDao.getByKey(key, corpid);
    }

    @Override
    public ContractEditFileEntity getLastByFileId(String fileId) {
        return contractEditFileDao.getLastByFileId(fileId);
    }

    @Override
    public List<ContractEditFileEntity> getByFileIdAndFileVersion(String corpid, List<Map<String, String>> list) {
        return contractEditFileDao.getByFileIdAndFileVersion(corpid,list);
    }

    @Override
    public void updateFileNameByFileIdAndFileVersion(String corpid, String fileId, Integer fileVersion, String fileName) {
        contractEditFileDao.updateFileNameByFileIdAndFileVersion(corpid,fileId,fileVersion,fileName);
    }

    @Override
    public ContractEditFileEntity getOneByFileIdAndFileVersion(String corpid, String fileId, Integer fileVersion) {
        return contractEditFileDao.getOneByFileIdAndFileVersion(corpid,fileId,fileVersion);
    }
}
